import logo.Mlog


class Role:
    def __init__(self, index: int, job: str, totalTimes: int=0):
        self.index = index
        self.job = job
        self.name=""
        self.totalTimes = totalTimes
        self.currTimes=0
    # index: int = 0
    # job: str = ""
    # totalTimes: int = 0
    # currTimes: int = 0

    # 检查是否打满了规定的次数规定
    def set_times(self, currTimes: int):
        self.currTimes = currTimes

    def is_ok(self)->bool:
        if self.currTimes >= self.totalTimes:
            return True
        else:
            return False


class User:
    email: str = ""
    pwd: str = ""
    currBrickRoleIndex: int = 0
    brick_roles = []
    currGoldRoleIndex: int = 0
    gold_roles = []
    IsWeChat:bool=True

    def get_brick_roles(self) -> Role:
        if self.currBrickRoleIndex > len(self.brick_roles) - 1:
            logo.Mlog.logger.error(f"获取角色错误，超出了角色范围 index={self.currBrickRoleIndex},roles={len(self.brick_roles)}")
            return None
        r = self.brick_roles[self.currBrickRoleIndex]
        self.currBrickRoleIndex += 1
        return r

    def get_gold_roles(self) -> Role:
        if self.currGoldRoleIndex > len(self.gold_roles) - 1:
            logo.Mlog.logger.error(f"获取角色错误，超出了角色范围 index={self.currGoldRoleIndex},roles={len(self.gold_roles)}")
            return None
        r = self.gold_roles[self.currGoldRoleIndex]
        self.currGoldRoleIndex += 1
        return r